package cc.lj.internal.mobilepay.application.service;

import cc.lj.internal.mobilepay.LjConfig;
import cc.lj.internal.mobilepay.application.utils.ReuqestCitic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 中信接口 app service 抽象类
 * @author liangxifeng
 * @date 2022/11/27 18:20
 */
@Service
public abstract class  CiticAppService<Q,R> {
    //中信日志生成类
    @Autowired
    protected CreateCiticLog citicLog;
    //请求中信类
    @Autowired
    protected ReuqestCitic reuqestCitic;
    //自定义配置类
    @Autowired
    protected LjConfig ljConfig;

    public abstract R doMain( Q requestCommand);

    /**
     * 生成终端信息，经纬度等等
     * @return
     */
    public String createTerminalInfo() {
        String terminalStr =  "{\"longitude\":"+ljConfig.getJingDu() +
                ",\"latitude\":" + ljConfig.getWeiDu() +
                ",\"device_type\":" + ljConfig.getDeviceType() +
                ",\"terminal_id\":\"" + ljConfig.getTerminalId() + "\"}";
        return terminalStr;
    }
}
